import { request } from "./request";


let category = ''
// 更新物品所需db架构(工序) - CT(Category/Type)
export function setMaterielCTCategory(cate) {
    if (cate) {
        if (cate.endsWith('/')) {
            category = cate;
        }
        else {
            category = `${cate}/`;
        }
    }
}

// 获取物品类型列表下拉
export function fetchGoodTypeSelect() {
    return request({
        url: `/MaterialManage/${category}MaterialTypes`,
    });
}
// 新增物品类型
export function fetchGoodAddTypes(data) {
    return request({
        url: `/MaterialManage/${category}MaterialType`,
        method: "post",
        data: data,
    });
}
// 更新物品类型
export function fetchGoodUpdateTypes(data) {
    return request({
        url: `/MaterialManage/${category}MaterialType`,
        method: "put",
        data: data,
    });
}
// 获取物品种类列表下拉
export function fetchGoodCategorySelect() {
    return request({
        url: `/MaterialManage/${category}MaterialCategories`,
    });
}
// 新增物品种类
export function fetchGoodAddCategory(data) {
    return request({
        url: `/MaterialManage/${category}MaterialCategory`,
        method: "post",
        data: data,
    });
}
// 更新物品种类
export function fetchGoodUpdateCategory(data) {
    return request({
        url: `/MaterialManage/${category}MaterialCategory`,
        method: "put",
        data: data,
    });
}
